﻿#include "point.h"

Point::Point() : x_( 0 ), y_( 0 ), radian_( 0 ) {}

Point::Point( double x, double y ) : radian_( 0 ) {
    x_ = x;
    y_ = y;
}

Point::Point( double x, double y, double radian ) {
    x_      = x;
    y_      = y;
    radian_ = radian;
}

double Point::x() const {
    return x_;
}

void Point::setX( double x ) {
    x_ = x;
}

double Point::y() const {
    return y_;
}

void Point::setY( double y ) {
    y_ = y;
}

double Point::radian() const {
    return radian_;
}

void Point::setRadian( double radian ) {
    radian_ = radian;
}

void Point::addX( double x ) {
    x_ += x;
}

void Point::addY( double y ) {
    y_ += y;
}

void Point::reset() {
    x_      = 0;
    y_      = 0;
    radian_ = 0;
}

/**
 * @brief operator << 重载qdebug,方便打印pose数据.使用方式:qDebug() << point;
 * @param debug
 * @param p
 * @return
 */
QDebug operator<<( QDebug debug, const Point& p ) {
    debug.noquote().nospace() << "(" << QString::number( p.x(), 'f', 0 ) << "，" << QString::number( p.y(), 'f', 0 ) << ")";
    return debug;
}
